package com.rslai.base.tool.servertest.objectfactory;

import com.rslai.base.tool.servertest.util.Util;

import java.lang.reflect.Type;

public class EnumFactory extends InstanceFactory {
    protected Object create(Type type, Object value) {
        if (Util.isEmpty(value).booleanValue()) return null;

        return Enum.valueOf((Class) type, value.toString());
    }

    protected boolean support(Type type) {
        if ((type instanceof Class)) {
            return ((Class) type).isEnum();
        }
        return false;
    }
}
